<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增账务检核作业管理')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-account-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">作业代码：</label>
                <div class="col-sm-8">
                    <input name="taskCode" class="form-control" readonly="true" autocomplete="off" type="text" th:value="${taskCode}" required />
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">作业名称：</label>
                <div class="col-sm-8">
                    <input name="taskName" class="form-control" autocomplete="off" required type="text">
                </div>
            </div>
           <div class="form-group">    
                <label class="col-sm-3 control-label is-required">系统代码：</label>
                <div class="col-sm-8">
                  <div class="input-group">
                         <input type="hidden" id="sysId" name="sysId" />
                     	 <input name="sysCode" onclick="selectMdSysModel()" required id="sysCode" autocomplete="off" type="text" placeholder="请选择系统" class="form-control">
                         <span class="input-group-addon"><i class="fa fa-search"></i></span>
                     </div>
                </div>
            </div>
            <div class="form-group">
				<label class="col-sm-3 control-label is-required">系统名称：</label>
				<div class="col-sm-8">
					<input id="sysName" name="sysName" required class="form-control" readonly="true" type="text"/>
				</div>
			</div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">账务类型：</label>
                <div class="col-sm-8">
                    <select name="accountType" class="form-control m-b" th:with="type=${@dict.getType('account_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">作业类名：</label>
                <div class="col-sm-8">
                    <input name="className" class="form-control" type="text" th:value="${className}" required />
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">类包名：</label>
                <div class="col-sm-8">
                    <input name="packageName" class="form-control" th:value="${packageName}" required type="text" />
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">总计SQL：</label>
                <div class="col-sm-8">
                    <textarea name="amountSql" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">明细SQL：</label>
                <div class="col-sm-8">
                    <textarea name="detailsSql" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">作业描述：</label>
                <div class="col-sm-8">
                    <textarea name="taskRemark" class="form-control"></textarea>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "verify/account";
		var prefix2 = ctx + "verify/rule";

        $("#form-account-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-account-add').serialize());
            }
        }
        
    	/* 选择系统 */
        function selectMdSysModel() {debugger;
        	var url = prefix2 + "/showMdSysList";
			var options = {
				title: '选择系统',
				width: "600",
				url: url,
				callBack: doSubmitMdSysData
			};
			$.modal.openOptions(options);
		}
    	
        function doSubmitMdSysData(index, layero){debugger;
	       var tableObj = layero.find("iframe")[0].contentWindow.$.table;
	       var sysId = tableObj.selectColumns("sysId")[0];
	       var sysCode = tableObj.selectColumns("sysCode")[0];
	       var sysName = tableObj.selectColumns("sysName")[0];
	        $("#sysId").val(sysId);
			$("#sysCode").val(sysCode);
			$("#sysName").val(sysName);
			layer.close(index);
	    }
    </script>
</body>
</html>